package acwing;

import java.io.*;

public class ac801 {
    static final int N = 100010;
    static int[] a = new int[N];
    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(in.readLine()) ;
        String[] s1 = in.readLine().split(" ");
        for(int i = 0; i < n; i ++ ) a[i] = Integer.parseInt(s1[i]);
        for(int i = 0; i < n; i ++ ){
            int res = 0;
            while(a[i] > 0){
                a[i] -= low_bit(a[i]);
                res ++ ;
            }
            System.out.print(res + " ");
        }
    }
    public static int low_bit(int x){
        return x & -x;
    }
}
